package 二叉搜索树;

public class Test {
    public static void main(String[] args) {
        BinarySearchTree binarySearchTree = new BinarySearchTree();
        int[] arr = {45,24,55,12,37,53,60,23,40,70};
        for (int i = 0;i < arr.length;i++){
            binarySearchTree.insert(arr[i]);
        }
        System.out.print("创建的搜索树中序遍历为--->:");
        binarySearchTree.inorder(binarySearchTree.root);
        System.out.println();
        System.out.println("查找值为37的结点地址-->:"+binarySearchTree.search(37));
        System.out.println("查找值为370的结点地址-->:"+binarySearchTree.search(370));
        binarySearchTree.insert(58);
        System.out.print("插入58后的中序遍历结果--->:");
        binarySearchTree.inorder(binarySearchTree.root);
        System.out.println();
        binarySearchTree.remove(45);
        System.out.print("删除值为45的结点后的中序遍历结果--->:");
        binarySearchTree.inorder(binarySearchTree.root);
        System.out.println();
    }
}
